package com.huffman.smart_picture.utils;

import com.huffman.smart_picture.domain.constants.CommonConstant;

import java.util.Date;

/**
 * @author DengLin
 * @title 热点数据判断工具
 * @date 2025/5/7
 */
public class HotDataUtil {
    private HotDataUtil() {

    }


    /**
     * 默认判断是否为30天内的热点数据
     * @param publishTime 发布时间
     * @return 是/否
     */
    public static boolean hotData(Date publishTime) {
        return hotData(publishTime, CommonConstant.ONE_DAY * 30);
    }

    /**
     * 判断是否为热点数据
     * @param publishTime
     * @param delay
     * @return
     */
    public static boolean hotData(Date publishTime, long delay) {
        Date endTime = new Date(publishTime.getTime() + delay);
        Date now = new Date();
        return now.before(endTime);
    }
}
